function formatter(): string;
function formatter(arg1: string): string;
function formatter(arg1: string, arg2: object): string;
function formatter(arg1: string, arg2: object, arg3: boolean): string;
function formatter(arg1: number): string;
function formatter(arg1: object): string;

// 对函数只定义不实现
function formatter(
  arg1?: string | number | undefined | object,
  arg2?: object,
  arg3?: boolean,
): string {
  if (typeof arg1 === "number") {
    return "";
  }
  if (typeof arg1 === "string") {
    return "";
  }

  console.log(arg1);
  console.log(arg2);
  console.log(arg3);
  return "";
}
formatter();
formatter("YYYY-MM-DD");
formatter("YYYY-MM-DD", { a: 1, b: 2 });
formatter("YYYY-MM-DD", { a: 1, b: 2 }, true);
formatter({ a: 1, b: 2 });
formatter(123);

formatter(123);

type Util = {
  formatter(): string;
  formatter(arg1: string): string;
  formatter(arg1: string, arg2: object): string;
  formatter(arg1: string, arg2: object, arg3: boolean): string;
  formatter(arg1: number): string;
  formatter(arg1: object): string;
};

const util: Util = {
  formatter(
    arg1?: string | number | undefined | object,
    arg2?: object,
    arg3?: boolean,
  ): string {
    console.log(arg1);
    console.log(arg2);
    console.log(arg3);

    return "";
  },
};

const myUser = util.formatter("YYYY-MM-DD");

util.formatter("YYYY-MM-DD", { a: 1, b: 2 });
util.formatter("YYYY-MM-DD", { a: 1, b: 2 }, true);
util.formatter({ a: 1, b: 2 });
util.formatter(333);

const abc = formatter("abc");
// this is test function
const my_test = util.formatter(123);
